﻿using System;
using System.Collections.Generic;
using GeoAPI.Geometries;
using NetTopologySuite.Geometries;

namespace NetTopologySuite.Operation.Distance
{
	public class ConnectedElementPointFilter : IGeometryFilter
	{
		public static IList<Coordinate> GetCoordinates(Geometry geom)
		{
			List<Coordinate> list = new List<Coordinate>();
			geom.Apply(new ConnectedElementPointFilter(list));
			return list;
		}

		private ConnectedElementPointFilter(IList<Coordinate> pts)
		{
			this._pts = pts;
		}

		public void Filter(IGeometry geom)
		{
			if (geom is IPoint || geom is ILineString || geom is IPolygon)
			{
				this._pts.Add(geom.Coordinate);
			}
		}

		private readonly IList<Coordinate> _pts;
	}
}
